package cn.mandy.sysadmin.component;

import cn.mandy.sysadmin.dto.MandyUserDetail;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Component;

// Spring Security - 获取当前登录用户的详细信息
// https://blog.csdn.net/cloume/article/details/84983006
@Component
public class AuthenticationUserImpl implements AuthenticationUser {
    @Override
    public MandyUserDetail getCurrentMmUser() {
        return (MandyUserDetail)SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    }
}
